import ajax from '../utils/ajax.js'
const form = document.forms[0]

form.onsubmit = async function (e) {
    e.preventDefault();
    // const result = await ajax("post", 'http://127.0.0.1/new/addNews', { a: 111, b: 222 })
    const result = await ajax("post", '/api/manage/register', {
        uid: form.uid.value,
        pwd: form.pwd.value
    })
    console.log(result);
    if (result.flag) {

        alert('注册成功')
        //token存储到本地
        localStorage.setItem('token', result.token)
        //跳转页面
        location.assign('index.html')
    }
}